package com.project.petLossSystem.util;

import java.util.HashMap;
import java.util.Map;

public class PageQueryUtil extends HashMap<String, Object> {
    private int page; // 当前页码
    private int rows; // 每页行数

    public PageQueryUtil(Map<String, Object> params) {
        this.putAll(params);
        this.page = Integer.parseInt(params.get("page").toString());
        this.rows = Integer.parseInt(params.get("rows").toString());
        // 这里需要重新put，因为mapper映射文件里map的value需要整数
        this.put("start", (page - 1) * rows);
        this.put("page", page);
        this.put("rows", rows);
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }
}
